package com.rpc.tagparser;

import com.rpc.tagparser.bean.ServiceConfigBean;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.util.StringUtils;
import org.w3c.dom.Element;

/**
 * @author didi
 * @DESCRIPTION
 * @create 2018-06-07 下午4:03
 **/

public class ServiceConfigBeanDefinitionParser extends AbstractConfigDefinitionParser {
    @Override
    protected Class<?> getBeanClass(Element element) {

        return ServiceConfigBean.class;
    }

    @Override
    protected void doParse(Element element, BeanDefinitionBuilder builder) {
        super.doParse(element, builder);
        String ref = element.getAttribute("ref");

        if (StringUtils.hasText("ref")) {
            builder.addPropertyValue("ref", ref);
        }
    }
}
